package com.cf.r1043_d;

import java.io.*;
import java.util.ArrayList;
import java.util.Collections;

public class b {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);
    static long[] pow10;
    static {
        pow10 = new long[19];
        pow10[0] = 1;
        for (int i = 1; i <= 18; i++) pow10[i] = pow10[i-1] * 10L;
    }

    public static void main(String[] args) throws IOException {
        int T = Integer.parseInt(br.readLine());
        while (T-- > 0) {
            solve();
        }
        out.flush();
        out.close();
        br.close();
    }

    // (10 ^ k + 1) * x = n，枚举 k
    static void solve() throws IOException {
        long n = Long.parseLong(br.readLine());
        ArrayList<Long> ans = new ArrayList<>();
        for (int k = 1; k <= 18; k++) {
            long x = pow10[k];
            if (x + 1 > n) break;
            long y = x + 1;
            if (n % y == 0) {
                ans.add(n / y);
            }
        }
        if (ans.isEmpty()) {
            out.println(0);
        } else {
            Collections.sort(ans);
            out.println(ans.size());
            for (long x : ans) {
                out.print(x + " ");
            }
            out.println();
        }
    }
}
